﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Site.Master" AutoEventWireup="true" CodeBehind="ADAdd.aspx.cs" Inherits="VK.Casemeet.Web.Admin.ADs.ADAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="contentHead" runat="server">
    <script type="text/javascript" src="/Scripts/ajaxupload.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentBody" runat="server">
    <div class="bodyContent divBody">
        <div class="divDetailOper">
            <asp:LinkButton ID="butSave" runat="server" CssClass="butSave" onclick="butSave_Click" OnClientClick="return validator.form();">保存信息</asp:LinkButton>
            <a class="butBack" href="ADList.aspx">返回列表</a>
        </div>
        <div class="divEdit" style="width:74%;margin:10px 0 0 1%;_margin:10px 0 0 0.5%;height:auto;">
            <div class="title">基本信息</div>
            <div class="content">
                <table cellpadding="0" cellspacing="0" class="tableLeftEdit">
                    <tbody>
                        <tr>
                            <th>标识：</th>
                            <td><asp:TextBox ID="txtCode" runat="server" CssClass="inputText required" Width="80%"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th>描述：</th>
                            <td><asp:TextBox ID="txtDescription" runat="server" CssClass="inputText required" Width="80%"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th>宽(px)：</th>
                            <td><asp:TextBox ID="txtWidth" runat="server" CssClass="inputText required" Width="80%"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th>高(px)：</th>
                            <td><asp:TextBox ID="txtHeight" runat="server" CssClass="inputText required" Width="80%"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th>链接地址：</th>
                            <td><asp:TextBox ID="txtUrl" runat="server" CssClass="inputText required" Width="80%"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th>打开方式：</th>
                            <td>
                                <asp:RadioButtonList ID="radTarget" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="selectrad">
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <th>广告图：</th>
                            <td>
                                <input id="hidImgUrl" name="hidImgUrl" type="hidden" value='<% =imgUrl %>' />
                                <div><a href="#" id="butImgUrl" class="flb hg30" style="color:#1d3d83;">【点我上传图片】</a><span class="padlef20" style="color:Red;"></span></div>
                                <script type="text/javascript">
                                    $(document).ready(function () {
                                        var button = $('#butImgUrl'), interval;
                                        new AjaxUpload(button, {
                                            action: '',
                                            onSubmit: function (file, ext) {
                                                if (!(ext && /^(jpg|png|jpeg|gif)$/.test(ext))) {
                                                    alert('错误:图片格式不正确!');
                                                    return false;
                                                }
                                                this._settings.action = '/PageHandler/UpLoadFile.ashx?folderName=ADs/';
                                                this._settings.data = { oldFileName: $('#divImgUrl img').attr('src') };
                                                this.disable();
                                                var tips = $("#butImgUrl").next();
                                                tips.html("文件上传中请等待");
                                                interval = window.setInterval(function () {
                                                    if (tips.html().length < 20) {
                                                        tips.html(tips.html() + ">");
                                                    } else {
                                                        tips.html('文件上传中请等待');
                                                    }
                                                }, 300);
                                            },
                                            onComplete: function (file, response) {
                                                $("#butImgUrl").next().html('');
                                                window.clearInterval(interval);
                                                this.enable();
                                                window.clearInterval(interval);
                                                var jsondata = JSON.parse(response);
                                                if (jsondata.Error.length == 0) {
                                                    $("#divImgUrl").html("");
                                                    $("#divImgUrl").append("<img alt='' src='/UserImages/ADs/" + jsondata.FileName + "' style='border:1px solid #bdbcbd;padding:3px;'/>");
                                                    $("#hidImgUrl").val(jsondata.FileName);
                                                } else {
                                                    alert(jsondata.Error);
                                                }
                                            }
                                        });
                                    });
                                </script>
                                <div id="divImgUrl"><img alt='' src='/UserImages/ADs/<% =imgUrl %>' style="border:1px solid #bdbcbd; padding:3px;" /></div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="divEdit" style="width:23%;margin:10px 0 0 1%;_margin:10px 0 0 0.5%;height:auto;">
            <div class="title">系统信息</div>
            <div class="content">
                <table cellpadding="0" cellspacing="0" class="tableRightEdit">
                    <tbody>
                        <tr><th>点击：</th></tr>
                        <tr><td><asp:TextBox ID="txtHits" runat="server" CssClass="inputText digits" Width="80%" Text="0"></asp:TextBox></td></tr>
                        <tr><th>启用：</th></tr>
                        <tr><td><asp:CheckBox ID="chkIsEnable" runat="server" Checked="true" /></td></tr>
                     </tbody>
                </table>
            </div>
        </div>
        <div class="clear f0" style="height:10px; width:100%"></div>
        <div class="clear divDetailOper">
            <asp:LinkButton ID="LinkButton1" runat="server" CssClass="butSave" onclick="butSave_Click" OnClientClick="return validator.form();">保存信息</asp:LinkButton>
            <a class="butBack" href="ADList.aspx">返回列表</a>
        </div>
        <div class="clear f0" style="height:20px; width:100%"></div>
    </div>
</asp:Content>
